package com.youdianda.config;

import com.youdianda.properties.AliOssProperties;
import com.youdianda.util.AliOssUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * alyunoss配置类
 */
@Configuration
public class AliyunOssConfiguration {

    /**
     * 将AliOssUtil注册成Bean对象封装到IOC容器中
     * @param aliOssProperties
     * @return
     */
    @Bean
    public AliOssUtil aliOssUtil(AliOssProperties aliOssProperties) {
        return new AliOssUtil(aliOssProperties.getEndpoint(), aliOssProperties.getAccessKeyId(),
                aliOssProperties.getAccessKeySecret(), aliOssProperties.getBucketName());
    }
}
